/*Author: Rony Lahav (ID:043489889)*/

/**
 * Activates the Filter command by adding a received filter to the relevant filter in the logger
 */

public class CmdFilter implements ICmd{

	private String filter;
	
	public CmdFilter(String filter){
		this.filter=filter;
	}
	
	//updates Filter value for printing filtering in Logger
	public void executeCmd(){
		if (!final_project.isShutDown()){
			String[] splittedFilter = filter.split("=");
			if (splittedFilter[0].equals(MessageCenter.TYPE_IM)){
				Logger.getInstance().addFilterIM(splittedFilter[1]);
			}
			else if (splittedFilter[0].equals(MessageCenter.TYPE_FT)){
				Logger.getInstance().addFilterFT(splittedFilter[1]);
			}
		}
	}
}
